﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace WyCash
{
    public class Bank
    {
        internal Hashtable rates = new Hashtable();

        internal  Money reduce(Expression source, string to)
        {
            //if (source is Money)
            //    { return (Money)source.reduce(to); }
            //Sum sum = (Sum)source;
            return source.reduce(this, to);
        }

        internal void addRate(string source, string to, int rate)
        {
            rates.Add(new Pair(source, to).from, rate);

        }
        internal int rate(string from, string to)
        {
            
            if (from.Equals(to)) return 1;
            int? rate = (int)rates[new Pair(from, to).from]; 
            return rate.Value;
        }

    }
}
